create-coliapp
Version:
Create projects like colidev 🚀. Inspired by 'create-appncy' by @goncy
30 lines (21 loc) • 697 B
text/typescript
import type {notDTO, DTO} from "./types";
import {ranges} from "../ranges";
import {FetchProps} from "../../types";
import {defaultObject} from "./consts";
import {map} from "./map";
import { fetchListFromSheet } from "../../data";
export async function fetchList(sheetUrl: string): Promise<DTO[]> {
const config: FetchProps<DTO> = {
sheetUrl,
range: ranges.yourPage,
map,
defaultObject,
};
const dogs = await fetchListFromSheet(config);
return dogs;
}
export async function getList(sheetUrl: string): Promise<notDTO[]> {
const list = await fetchList(sheetUrl);
const filtered = list.filter((x) => x.isActive);
return filtered;
}